<template>
    <view>
        <view class="head ba_f">
            <view @tap="one" :class="ac_index == 0 ? 'sele' : 'no_sele'" :style="'border-color:' + (ac_index == 0 ? color : '')">一级</view>
            <view @tap="two" :class="ac_index == 1 ? 'sele' : 'no_sele'" :style="'border-color:' + (ac_index == 1 ? color : '')" v-if="fxset.is_ej == '2'">二级</view>
        </view>
        <view class="list mar_t ba_f" v-if="ac_index == 0">
            <view class="pa" v-for="(item, index) in MyTeam.one" :key="index">
                <view>
                    <image class="dis_in" mode="aspectFill" :src="item.img"></image>
                    <view class="dis_in">
                        <view class="fon_30 color_6">{{ item.name }}</view>
                        <view class="fon_24 color_9 pa_0">成为下线时间 {{ item.time }}</view>
                    </view>
                </view>
            </view>
        </view>
        <view class="jzwb" v-if="ac_index == 0 && MyTeam.one.length == 0">
            <view class="hx"></view>
            <view class="wz">您暂无一级团队哦~</view>
            <view class="hx"></view>
        </view>
        <view class="list mar_t ba_f" v-if="ac_index == 1">
            <view class="pa" v-for="(item, index) in MyTeam.two" :key="index">
                <view>
                    <image class="dis_in" mode="aspectFill" :src="item.img"></image>
                    <view class="dis_in">
                        <view class="fon_30 color_6">{{ item.name }}</view>
                        <view class="fon_24 color_9 pa_0">成为下线时间 {{ item.time }}</view>
                    </view>
                </view>
            </view>
        </view>
        <view class="jzwb" v-if="ac_index == 1 && MyTeam.two.length == 0">
            <view class="hx"></view>
            <view class="wz">您暂无二级团队哦~</view>
            <view class="hx"></view>
        </view>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            ac_index: 0,

            MyTeam: {
                one: [],
                two: []
            },

            fxset: {
                is_ej: ''
            },

            color: ''
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        var that = this;
        var e = uni.getStorageSync('users').id;
        app.globalData.util.request({
            url: 'entry/wxapp/MyTeam',
            cachetime: '0',
            data: {
                user_id: e
            },
            success: function (t) {
                console.log(t.data);
                that.setData({
                    MyTeam: t.data
                });
            }
        });
        app.globalData.util.request({
            url: 'entry/wxapp/CheckRetail',
            cachetime: '0',
            success: function (t) {
                console.log(t);
                that.setData({
                    fxset: t.data
                });
                uni.setNavigationBarTitle({
                    title: t.data.xx_name
                });
            }
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {},
    methods: {
        one: function (t) {
            this.setData({
                ac_index: 0
            });
        },

        two: function (t) {
            this.setData({
                ac_index: 1
            });
        }
    }
};
</script>
<style>
@import './downline.css';
</style>
